<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>东莞新华投票系统v1.0</title>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <link rel="stylesheet" type="text/css" href="css/tipswindown.css" />
    <script src="js/jquery-1.5.2.js" type="text/javascript"></script>
    <script src="js/tipswindown.js" type="text/javascript"></script>
    <script src="js/checkinput.js" type="text/javascript"></script>
</head>
<body id="rep-password">

<?php

if (!isset($_COOKIE['islogin']) || $_COOKIE['islogin'] != 1) {
    echo "<script>window.location.href='login.php';</script>";
}
if(isset($_POST['submit'])){
$account = $_COOKIE['username'];
$newpassword = $_POST['new_password'];
    if($newpassword!="123456") {


        require('config.php');
        $result_update_pass = mysql_query("update users set pass='$newpassword' where account='$account'") or die(mysql_error());
        if ($result_update_pass > 0) {
            echo "<script>alert('密码修成功！');window.location.href='index.php';</script>";

        }
    }else{
        echo "<script>alert('密码修改失败：密码不能为初始密码，请重新修改！')</script>";
}
}
?>
<div id="nav">
    <div id="nav_top">
        <div class="width navs">
            <div class="logo">
                <a href="index.php"><img src="images/logo.png" width="290" height="54"/></a>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div id="header">
        <div class="width">

        </div>
    </div>
</div>

<div id="content">
    <div id="main-content">
        <div id="base" style="width: 400px;height: 250px;margin: 0 auto;">
            <h3>密码修改</h3>
            <form method="post" action="rep-password.php" style="width:250px; margin:0 auto;" onsubmit="return checkinput()" >
<!--                <p style="text-align:right;">账号：<input type="text" readonly="readonly" value="--><?php //echo $account;?><!--"></p>-->
                <p style="text-align:right;">新密码：<input name="new_password" type="password" class="noempty"></p>
                <p style="text-align:right;">确认新密码：<input type="password" class="noempty"></p>
                <p style="text-align:center;"><button type="submit" name="submit" class="btn btn-primary">提交</button></p>
            </form>
        </div>
    </div>

</div>


<!--footer be-->
<div id="footer" class="clear">
    <div
        style="background: url(images/gx_footer.gif) no-repeat; width: auto; height: 118px; padding: 20px 0 0 0;">
        <div class="width">
            <div style="text-align: center; font-size: 14px;">
                <a href="http://10.44.152.49">东莞新华导航页</a> <a
                    href="http://10.44.152.252./purchase" class="a1" target="ifm">采购立项签报系统</a> <a
                    href="http://10.44.152.166:8080/che/">用车管理系统</a> <a href="http://10.44.152.166:8080/caigou/"
                    >采购随机筛选系统</a>
            </div>
            <div style="margin: 15px 0 0 0; font-size: 11px; text-align: center;">新华人寿保险股份有限公司东莞中心支公司
                版权所有 东莞新华办公室
            </div>
        </div>
    </div>
</div>
</body>
</html>